﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_CRD_INFO_Get_Card_Used_Location_Markers')
	BEGIN
		DROP Procedure usp_UPDMS_CRD_INFO_Get_Card_Used_Location_Markers
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_CRD_INFO_Get_Card_Used_Location_Markers
**	Desc : 카드사용장소
**	Test Exec Query : Exec usp_UPDMS_CRD_INFO_Get_Card_Used_Location_Markers 'CC07X,CC06X,CC02X,CC09X,CC03X,CC04X,CC05X,CC01X,CC08X'
**	Called by : Crd_Dac_UPDMS_CRD_INFO.cs
**	Program ID : NaverMapMulitMarker
**	Auth : 송시명
**	Date : 2011-08-27
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_CRD_INFO_Get_Card_Used_Location_Markers]
@ls_card_cd nvarchar(max)
AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SET NOCOUNT ON

SELECT DISTINCT
       Latitude + ',' + Longitude + ',' + Contents AS Markers
  FROM (
       SELECT Latitude,
              Longitude,
			  Contents
         FROM UPDMS_CRD_ITEM_BIZ WITH(NOLOCK)
        WHERE Card_Cd IN (SELECT Rslt FROM dbo.ufn_UPDMS_Get_Rslt_At_Comma(@ls_card_cd))
          AND LEN(Latitude + Longitude) = 12
       UNION ALL
       SELECT Latitude,
              Longitude,
			  Contents
         FROM UPDMS_CRD_INSTALLMENT_BIZ WITH(NOLOCK)
        WHERE Card_Cd IN (SELECT Rslt FROM dbo.ufn_UPDMS_Get_Rslt_At_Comma(@ls_card_cd))
          AND LEN(Latitude + Longitude) = 12
       ) Z

GO
